class Connector
  attr_accessor :client,:object,:list
  def initialize(server,ui,ins)
    @ins = ins
    Wx::Timer.every(25) { Thread.pass}
    @server = server
    $client = self
    @ui = ui

  end
  def getLogInString()
    @loginstring = @server.prefix+""+@server.cname+" "+@server.pass 
  end
  def do_connect()
        getLogInString()
	host = @server.host
	port = @server.port
	client = Client::new host,port
	client.read
	
	client.loadServerModules("mu-module","penn-module")
	client.assignDefaultServerModule(Penn)
# 	client.socket.puts "connect One"
	client.socket.puts @loginstring
	client.send_wait << ""
	dbref = client.recieve_data("th #{client.get_header}%r%#%r#{client.get_footer}",0)
	dbref.gsub!("\r\n",'')
	client.object = Penn::PlayerObject::new
	client.object.dbref = dbref
	client.object.connection = client
	Penn::set_object(client.object,client)
	client.type.realiseObject(client.object,dbref,client)
# 	@client = client
	object = client.object
        @client,@object = client,object
        add_object object,@ins.get_object_list
#         add_object @client.type.realiseObject(nil,get_location,@client),@list
        GC::start
  end
  def give(string,fclr,bclr)
#     si = @m_textctrl13
    f = Wx::Font.new(10, Wx::MODERN, -1,-1, false)
    @ui.output.set_default_style Wx::TextAttr::new(Wx::Colour::new(bclr),Wx::Colour::new(fclr),f)
    begin
#     p string
    @ui.output.append_text string
    rescue
    end
    @ui.output.show_position @ui.output.get_last_position
  end
end